Download & Extend

Make the GET page variable consistent with the real page number

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.

AttachmentSizeStatusTest resultOperations
pager.patch873 bytesIdlePassed: 12399 passes, 0 fails, 0 exceptionsView details | Re-test

Comments

#1

Version:6.10» 7.x-dev

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.

AttachmentSizeStatusTest resultOperations
pager.patch1006 bytesIdlePassed: 12390 passes, 0 fails, 0 exceptionsView details | Re-test

#4

Status:needs review» needs work

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.

AttachmentSizeStatusTest resultOperations
pager.patch1008 bytesIdleFailed: 12362 passes, 4 fails, 0 exceptionsView details | Re-test

#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

Status:needs work» needs review

I think the comments in #5 are great.

#8

Status:needs review» needs work

The last submitted patch failed testing.

#9

Title:Make consistent the GET page variable with the real page number» Make the GET page variable consistent with the real page number

grammar...

#10

Version:7.x-dev» 8.x-dev

This is, sadly, too late for D7. We should do this at the start of D8.

#11

Version:8.x-dev» 7.x-dev
Assigned to:Anonymous» Steven Jones

subscribe.

#12

Version:7.x-dev» 8.x-dev
Assigned to:Steven Jones» Anonymous

#13

Version:8.x-dev» 7.x-dev
Assigned to:Anonymous» Steven Jones

Cross posts galore!

#14

Version:7.x-dev» 8.x-dev

Argh!!!

#15

Version:8.x-dev» 7.x-dev
Status:needs work» needs review

Just want to see what the test bot will make of this patch, then will move to D8.

AttachmentSizeStatusTest resultOperations
pager_0.patch919 bytesIdleFAILED: [[SimpleTest]]: [MySQL] 30,402 pass(es), 17 fail(s), and 0 exception(es).View details | Re-test

#16

Status:needs review» needs work

The last submitted patch, pager_0.patch, failed testing.

#17

Version:7.x-dev» 8.x-dev

#18

Status:needs work» needs review

One last go...

AttachmentSizeStatusTest resultOperations
drupal-385270.patch9.95 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-385270.patch.View details | Re-test

#19

Version:8.x-dev» 7.x-dev

for D7.

#20

Version:7.x-dev» 8.x-dev

Victory! Patch is good for D7, but this issue should change in D8.

#21

Assigned to:Steven Jones» Anonymous

#22

#18: drupal-385270.patch queued for re-testing.

#23

Subscribe

#24

#18: drupal-385270.patch queued for re-testing.

#25

Status:needs review» needs work

The last submitted patch, drupal-385270.patch, failed testing.

#26

Status:needs work» needs review

Well, that was a very old patch, so a quick, cosmetic re-roll.

AttachmentSizeStatusTest resultOperations
drupal-385270-pager-consistent-26.patch9.04 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-385270-pager-consistent-26.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#27

Subscribing.

#28

#29

Status:needs review» needs work

The last submitted patch, drupal-385270-pager-consistent-26.patch, failed testing.

#30

Status:needs work» needs review

Re-roll.

AttachmentSizeStatusTest resultOperations
drupal-385270-pager-consistent-30.patch9.02 KBIdlePASSED: [[SimpleTest]]: [MySQL] 33,289 pass(es).View details | Re-test