This bug is viewable even right here on drupal.org. To find it, simple search for anything that will result in pagination being displayed at the bottom of any page. Hover over "Page 2" and you will notice that the URL actually says page=1. This is because Page 2 is actually Page 0 + 1. Technically correct but logically incorrect. No regular joe is going to understand that page=1 is actually page 2. I had never noticed this before until someone said "Got to page X" so thinking I was going to be sneaky, I went to page X by typing in page=X which of course was going to be 1 page off. This bug has existed from 4.x and persists right through 7.x!!! Anyways, I posted a fix for it here:
http://drupal.org/node/73207#comment-961385
It's a simple 2 line fix and doesnt really need a .patch file but here it is anyways.
| Comment | File | Size | Author |
|---|---|---|---|
| pager.inc_.patch | 961 bytes | LanceLight |
Comments
Comment #1
kappaluppa commentedCool! This is great...
Comment #2
drummThis would break everyone's bookmarks and URLs, which is unacceptable. It might be possible to change this in a major Drupal release, such as Drupal 7.0.
We do not sign code comments with names. The CVS logs and archives of these issue pages take care of attribution. Something like "Fix drupal's pagination." should either be left out or improved to something like "Make page number in URL match the UI."
Comment #3
LanceLight commentedComment #4
LanceLight commentedSo you wont fix a well known bug because it'll break some dudes bookmarks to the drupal.org website? Erm. Ok, whatever you say but I completely disagree with the mentality of lets not fix it because it might break someones bookmarks. As for bad url's/links within the site, that is easily fixed by running a db update during the upgrade process or if the update is called specifically from somewhere, I use a module to do it myself. If you need such an update script, I have one already since I have to do this on every single drupal site I encounter anyways and it doesnt take like all day to run either. 30 mins tops for sites that have a DB around 900GBs (thats the largest I've run it on so far, it took about 18 minutes). So I'd say lets not let this bug persist anymore, its really not that hard to fix up. Really, it isnt. I'd put it in cvs myself if I had commit access including the sql update query :P````
Comment #5
LanceLight commentedmmm patch is for 5.x. even though the same bug exists in all versions of drupal.
Comment #6
killes@www.drop.org commentedThe numbering scheme for paged pages was chosen deliberately.
Comment #7
drummThe issue queue does send email, so I did get a copy of your original comment which you edited:
If you read Drupal's code, you will see that my recommendations are consistent with Drupal's overall code quality.
I do appreciate your contributions, but have a problem with your attitude. I offered constructive criticism and you reply with insults and rants.
Comment #9
LanceLight commentedO really, and what would the reasoning be behind purposely using logically wrong page numbers? Maybe google should think about purposely using the wrong page numbers on their search pages. Makes perfect sense right? Search page 1 is actually the 2nd set of results? Sure, makes sense to me. And I have some gold mines for sale in Florida too. Phhhhh by design. Humor me some more please.
Comment #10
LanceLight commentedComment #11
beeradb commentedRegardless of how strongly you feel about this, in most situations patches should not be RBTC'd by the person who created them.
Comment #12
greggles@LanceLight, I'll just say that you're dangerously close to getting blocked. Your attitude and tone is not tolerated beyond a warning, which you've already received more than once.
The code needs work and, since it's something that will "break" the url structure, it belongs in 7.x if it's going to get committed anywyere.
As a solution to the broken url problem we could easily provide a slightly modified pagination url like "?pager=1" instead of "?page=1" that way Drupal/Apache could detect the page= style url and 301 them to the new URL. We've done this several times in the past and fixed it via commented out .htaccess rules and the now removed legacy.module
Comment #13
michelleI definitely agree this needs to go in 7 if anywhere as it will also break anything that relies on the way the numbers are set up now, such as advforum.
Michelle
Comment #14
damien tournoud commentedIn most cases, the page number is not semantically significant. It is only an artifact of the way we want to display lists by splitting them in several pages.
Having "?page=1" instead of "?page=0" don't change anything because those pages are generally not meant to be used by humans: they are *not* permanent, so you can't refer another human to "page 3 of that list", because if the items in the list change the page can potentially look all different.
So this is a won't fix: there is no bug here. The case you are referring to (the page number in a list of messages ordered chronologically, like in a forum) is not the general case. Maybe Michelle could consider adding such a "feature" to advanced forum?
Comment #15
michelle@Damien - Sorry, not really interested in re-implementing the core paging system in advforum just to shift the number by 1. :)
Michelle
Comment #16
lanny heidbreder commentedThis is probably futile, but five and a half years after the last post, I thought I'd take a crack at begging and pleading for this for Drupal 9, since it's probably too late for Drupal 8.
The existing, won't-fixed behavior is really, really terrible, and it betrays the lack of concern for user experience and lack of taste that the Drupal community has struggled with for so long. But user experience is getting some attention these days, so maybe it's time to look at this again.
The address bar is as much a part of a site's user interface as what happens in the viewport. Maybe less technically savvy users don't look at URLs much, but more savvy users are Drupal users, too. And anyone who looks would be baffled and confused and wonder if something's wrong if they clicked "Next" on a pager and saw that the next page was
?page=1.It's sloppy, it's amateurish, it's user-hostile, and for at least some people sometimes, it's a real usability issue. Any one of those should mean it needs to be fixed someday. I'd love to see it fixed in Drupal 8 since it's not released yet, but if that's impossible, it needs to make it into Drupal 9.
Comment #17
lanny heidbreder commentedMoving this to 8.x-dev to get attention. I'm pretty sure people are going to yell at me and tell me D8 is way past the point where this is possible, but I thought I'd try, just in case.
Comment #18
lanny heidbreder commentedMarked as duplicate of #1818040: Pager should start counting from 1, not 0