Posted by Jean-Philippe Fleury on February 27, 2009 at 2:35am
| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | base system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Drupal's pagination is a bit geeky: it starts from 0 instead of 1. If we are on the first page and we click on the number 2 (or on the "next" link) in the navigation bar, we're displaying the second page, but the $_GET['page'] variable on the url is ?page=1.
$_GET['page'] variable is one lower than the real page number marked in the navigation bar. For most people, I think that it's a bit disconcerting and not ergonomics.
I attach a patch that makes pagination start to 1 instead of 0. See http://drupal.org/node/73207#comment-961385 Thanks to LanceLight.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| pager.patch | 873 bytes | Idle | Passed: 12399 passes, 0 fails, 0 exceptions | View details | Re-test |
Comments
#1
This will need to go against HEAD, and then (possibly, but unlikely) to be back ported. Nice idea!
#2
empty string minus one equals ????
also, the documnetation must be extended, something like
// Translate human readable page numbers to PHP offset logic
and vice verca
#3
OK, new patch.
#4
Both of the comments need a period on the end. Not sure the wording is quite right, but don't have suggestions.
#5
catch wrote:
> Both of the comments need a period on the end.
New patch.
#6
This is an excellent idea.
A couple of suggestions for the comments if you don't want these ones:
// Translate human readable page numbers to PHP offset logic.
could be:
// Translate one based page numbers to be zero based for php usage.
// Translate PHP offset logic to human readable page numbers.
could be:
// Translate zero based page numbers to be one based for better human readability.
#7
I think the comments in #5 are great.
#8
The last submitted patch failed testing.
#9
grammar...
#10
This is, sadly, too late for D7. We should do this at the start of D8.
#11
subscribe.
#12
#13
Cross posts galore!
#14
Argh!!!
#15
Just want to see what the test bot will make of this patch, then will move to D8.
#16
The last submitted patch, pager_0.patch, failed testing.
#17
#18
One last go...
#19
for D7.
#20
Victory! Patch is good for D7, but this issue should change in D8.
#21
#22
#18: drupal-385270.patch queued for re-testing.
#23
Subscribe
#24
#18: drupal-385270.patch queued for re-testing.
#25
The last submitted patch, drupal-385270.patch, failed testing.
#26
Well, that was a very old patch, so a quick, cosmetic re-roll.
#27
Subscribing.
#28
#26: drupal-385270-pager-consistent-26.patch queued for re-testing.
#29
The last submitted patch, drupal-385270-pager-consistent-26.patch, failed testing.
#30
Re-roll.