HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.

Vanilla Pagination Bug

dan39dan39 New
edited May 2007 in Vanilla 1.0 Help
Hey, is this a bug?

"The Official I Hate PCs Discussion" just surpassed 8 pages. But, when you are on Page 1, the pagination doesn't show you that the last page is actually Page #9. However, on the Discussions index, the pagination shows you what the final page of Discussions is. For instance, it currently says "8...143 >"

I think I've noticed similar behavior when the Discussions index surpases 8 pages for the first time.

Is there a point where it begins to show you what the context of the last page is?

Comments

  • Mmm.. interesting indeed :)
  • edited January 2007
    It looks like it calculates the number of pages by multiples of 50 comments. Only when you get to the last page does it realize it has a few more for another page. Isn't there an extension that adds this capability? I'll look at the code in it to see how it is calculating.

    The DiscussionPages extension probably has the same code as here.
    $PageCount = CalculateNumberOfPages($Discussion->CountComments, $CommentsPerPage);

    It's probably doing some integer rounding.
    Yep, I found it in the framework functions. It is rounding the count.
  • not to derail, but anyone else have to do a double take on the discussion title?
  • No double take, but a deja vu: http://lussumo.com/community/discussion/5001/discussion-page-link-list-bug/
  • Concerning the title, I had the same take --- if you merge the words together, it's funny.
  • I don't know if it's related, but I *think* I've also noticed it not taking me to the first unread post when it is on a new page. I say think because I'm not 100% sure. What happens is that when I click on the discussion I get taken to my previous first unread post until I have been to the next page, then it works fine again. I think I also noticed this on the PC thread, and around pages 5-8. It may have been happening before, but I really don't recall.
  • I think you always get moved to first new post-1. So if the first new post is #20, you get moved to #19. Which means if the first new post is on a new page, you'll get moved to the last post on the page before it.
  • Ah, then *I* see this as problem :/
  • Hey, Mark, any news on the rounding issue? I noticed it's still happening in Vanilla 1.1.2.
  • MarkMark Vanilla Staff
    I haven't had time to look into it - does anyone have a bugfix for this?
  • The rounding that jimw talked about seemed to work just fine.

    What I think it is, is if ($CurrentPage < ($PageCount - $MidPoint) && $PageCount > $this->PagesToDisplay + 1) { on line 215 in Framework.Class.PageList. I think it should be if ($CurrentPage < ($PageCount - $MidPoint) && $PageCount > $this->PagesToDisplay - 1) { (minus instead of plus at the end there).
  • MarkMark Vanilla Staff
    Okay - I've changed it and committed to svn - let's hope it works!
This discussion has been closed.