diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 165444499..5b0678fe4 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -654,8 +654,17 @@ $total_page = 1; } - // check the page variables - if ($page > $total_page) $page = $total_page; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); diff --git a/classes/db/DBFirebird.class.php b/classes/db/DBFirebird.class.php index 8327cdcb6..404f0fd35 100644 --- a/classes/db/DBFirebird.class.php +++ b/classes/db/DBFirebird.class.php @@ -753,13 +753,23 @@ if ($total_count) $total_page = (int) (($total_count - 1) / $list_count) + 1; else $total_page = 1; - if($page > $total_page) $page = $total_page; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page-1)*$list_count; $query = $this->getSelectSql($queryObject, true, $start_count); - if(strpos($query, "substr")) { - $query = str_replace ("substr", "substring", $query); - $query = $this->replaceSubstrFormat($query); + if(strpos($query, "substr")) { + $query = str_replace ("substr", "substring", $query); + $query = $this->replaceSubstrFormat($query); } $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; $result = $this->_query ($query, null, $connection); diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index a9579edd5..8878e5389 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -514,14 +514,23 @@ $total_page = (int) (($total_count - 1) / $list_count) + 1; } else $total_page = 1; - // check the page variables - if ($page > $total_page) $page = $total_page; - $start_count = ($page - 1) * $list_count; + // check the page variables + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list - $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; - $result = $this->_query ($query, $connection); - if ($this->isError ()) - return $this->queryError($queryObject); + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } + $start_count = ($page - 1) * $list_count; + + $query .= (__DEBUG_QUERY__&1 && $queryObject->query_id)?sprintf (' '.$this->comment_syntax, $this->query_id):''; + $result = $this->_query ($query, $connection); + if ($this->isError ()) + return $this->queryError($queryObject); $virtual_no = $total_count - ($page - 1) * $list_count; $data = $this->_fetch($result, $virtual_no); diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 70c59d30a..48ce8811d 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -499,7 +499,16 @@ $total_page = 1; // check the page variables - if ($page > $total_page) $page = $total_page; + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $query = $this->getSelectPageSql($queryObject, true, $start_count, $list_count); diff --git a/classes/db/DBSqlite3_pdo.class.php b/classes/db/DBSqlite3_pdo.class.php index e8e7e1d0f..f990963b3 100644 --- a/classes/db/DBSqlite3_pdo.class.php +++ b/classes/db/DBSqlite3_pdo.class.php @@ -517,7 +517,16 @@ $total_page = 1; // check the page variables - if ($page > $total_page) $page = $total_page; + if ($page > $total_page) { + // If requested page is bigger than total number of pages, return empty list + + $buff = new Object (); + $buff->total_count = $total_count; + $buff->total_page = $total_page; + $buff->page = $page; + $buff->data = array(); + $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); + } $start_count = ($page - 1) * $list_count; $this->_prepare($this->getSelectPageSql($queryObject, true, $start_count, $list_count));