summaryrefslogtreecommitdiffstats
path: root/system/libraries/Pagination.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-01-03 10:01:50 +0100
committerAndrey Andreev <narf@bofh.bg>2012-01-03 10:01:50 +0100
commit166396ed9e03f78444970372983d50fd34a5ca96 (patch)
treef209bdbc89c0e4310ebf772299e0bd7e7ecef68d /system/libraries/Pagination.php
parentb195637240bbbc7c3dc7ee0585f0e4cd39cb9d81 (diff)
parent29e1122c19c532b7299598fb7ddfb7f15264ad78 (diff)
Merge remote-tracking branch 'upstream/develop' into develop-xmlrpc
Diffstat (limited to 'system/libraries/Pagination.php')
-rw-r--r--system/libraries/Pagination.php32
1 files changed, 9 insertions, 23 deletions
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index eea953ae4..23ca549e2 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -1,4 +1,4 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
@@ -18,7 +18,7 @@
*
* @package CodeIgniter
* @author EllisLab Dev Team
- * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+ * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* @link http://codeigniter.com
* @since Version 1.0
@@ -131,7 +131,7 @@ class CI_Pagination {
$num_pages = ceil($this->total_rows / $this->per_page);
// Is there only one page? Hm... nothing more to do here then.
- if ($num_pages == 1)
+ if ($num_pages === 1)
{
return '';
}
@@ -146,25 +146,16 @@ class CI_Pagination {
{
if ($CI->input->get($this->query_string_segment) != $base_page)
{
- $this->cur_page = $CI->input->get($this->query_string_segment);
-
- // Prep the current page - no funny business!
- $this->cur_page = (int) $this->cur_page;
+ $this->cur_page = (int) $CI->input->get($this->query_string_segment);
}
}
- else
+ elseif ($CI->uri->segment($this->uri_segment) != $base_page)
{
- if ($CI->uri->segment($this->uri_segment) != $base_page)
- {
- $this->cur_page = $CI->uri->segment($this->uri_segment);
-
- // Prep the current page - no funny business!
- $this->cur_page = (int) $this->cur_page;
- }
+ $this->cur_page = (int) $CI->uri->segment($this->uri_segment);
}
- // Set current page to 1 if using page numbers instead of offset
- if ($this->use_page_numbers AND $this->cur_page == 0)
+ // Set current page to 1 if it's not valid or if using page numbers instead of offset
+ if ( ! is_numeric($this->cur_page) OR ($this->use_page_numbers AND $this->cur_page == 0))
{
$this->cur_page = $base_page;
}
@@ -176,11 +167,6 @@ class CI_Pagination {
show_error('Your number of links must be a positive number.');
}
- if ( ! is_numeric($this->cur_page))
- {
- $this->cur_page = $base_page;
- }
-
// Is the page number beyond the result range?
// If so we show the last page
if ($this->use_page_numbers)
@@ -310,4 +296,4 @@ class CI_Pagination {
// END Pagination Class
/* End of file Pagination.php */
-/* Location: ./system/libraries/Pagination.php */ \ No newline at end of file
+/* Location: ./system/libraries/Pagination.php */