From 99f0669aae4f91eab0484430ef68a70e5b20d85c Mon Sep 17 00:00:00 2001 From: Geert De Deckere Date: Fri, 11 Jun 2010 20:00:59 +0200 Subject: [PATCH] Fixed #2951. Added valid_page() method. --- classes/kohana/pagination.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/classes/kohana/pagination.php b/classes/kohana/pagination.php index 6702727..e6e024e 100644 --- a/classes/kohana/pagination.php +++ b/classes/kohana/pagination.php @@ -197,6 +197,22 @@ class Kohana_Pagination { } /** + * Checks whether the given page number exists. + * + * @param integer page number + * @return boolean + * @since 3.0.7 + */ + public function valid_page($page) + { + // Page number has to be a clean integer + if ( ! Validate::digit($page)) + return FALSE; + + return $page > 0 AND $page <= $this->total_pages; + } + + /** * Renders the pagination links. * * @param mixed string of the view to use, or a Kohana_View object -- 2.11.4.GIT