Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes with pagination #2016

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions system/libraries/Pagination.php
Expand Up @@ -460,19 +460,20 @@ public function create_links()
// Unset the controll, method, old-school routing options
unset($get['c'], $get['m'], $get[$this->query_string_segment]);

if ( ! $get) $get = array();

// Put everything else onto the end
$query_string = (strpos($this->base_url, '&') !== FALSE ? '&' : '?') . http_build_query($get, '', '&');
if ( ! empty($get))
{
// Put everything else onto the end
$query_string = (strpos($this->base_url, '?') !== FALSE ? '&' : '?') . http_build_query($get, '', '&');

// Add this after the suffix to put it into more links easily
$this->suffix .= $query_string;
// Add this after the suffix to put it into more links easily
$this->suffix .= $query_string;
}
}

// Render the "First" link
if ($this->first_link !== FALSE && $this->cur_page > ($this->num_links + 1))
{
$first_url = ($this->first_url === '') ? $this->base_url : $this->first_url;
$first_url = ($this->first_url === '') ? $this->prefix.$this->base_url.$this->suffix : $this->first_url;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a separate issue and some would argue if there should be a prefix for it or not ... let's keep this one limited to the query string part.

P.S.: Just commit and push the changes to the same branch, you don't need to close and create another pull request.


// Take the general parameters, and squeeze this pagination-page attr in there for JS fw's
$attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, 1);
Expand Down