Commit c0bb4f6b authored by tim.plunkett's avatar tim.plunkett
Browse files

Issue #1757302 by tim.plunkett: Prevent current_page from being set to -1.

parent 131ea0f6
......@@ -380,14 +380,15 @@ function update_page_info() {
// Calculate and set the count of available pages.
$pager_total[$this->options['id']] = $this->get_pager_total();
// @todo Use set_current_page() here: http://drupal.org/node/1758766
if ($this->current_page >= $pager_total[$this->options['id']]) {
// Pages are numbered from 0 so if there are 10 pages, the last page is 9.
$this->current_page = $pager_total[$this->options['id']] - 1;
}
// See if the requested page was within range:
if ($this->current_page < 0) {
$this->current_page = 0;
}
elseif ($this->current_page >= $pager_total[$this->options['id']]) {
// Pages are numbered from 0 so if there are 10 pages, the last page is 9.
$this->current_page = $pager_total[$this->options['id']] - 1;
}
// Put this number in to guarantee that we do not generate notices when the pager
// goes to look for it later.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment