diff --git includes/view.inc includes/view.inc index 496081a..dc3819e 100644 --- includes/view.inc +++ includes/view.inc @@ -715,6 +715,20 @@ class view extends views_db_object { $this->build_info['query_args'] = $args; } + if (!empty($this->pager['items_per_page']) && !empty($this->pager['use_pager'])) { + global $pager_page_array; + + // What page was requested: + $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array(); + + if (!empty($pager_page_array[$this->pager['element']])) { + $page = intval($pager_page_array[$this->pager['element']]); + $this->pager['current_page'] = $page; + } + + $this->build_info['page'] = $page; + } + // Check for already-cached results. if (!empty($this->live_preview)) { $cache = FALSE; @@ -746,22 +760,16 @@ class view extends views_db_object { if (!empty($this->pager['use_pager'])) { // dump information about what we already know into the globals - global $pager_page_array, $pager_total, $pager_total_items; + global $pager_total, $pager_total_items; // total rows in query $pager_total_items[$this->pager['element']] = $this->total_rows; // total pages $pager_total[$this->pager['element']] = ceil($pager_total_items[$this->pager['element']] / $this->pager['items_per_page']); - // What page was requested: - $pager_page_array = isset($_GET['page']) ? explode(',', $_GET['page']) : array(); - // If the requested page was within range. $this->pager['current_page'] // defaults to 0 so we don't need to set it in an out-of-range condition. - if (!empty($pager_page_array[$this->pager['element']])) { - $page = intval($pager_page_array[$this->pager['element']]); - if ($page > 0 && $page < $pager_total[$this->pager['element']]) { - $this->pager['current_page'] = $page; - } + if ($page < 0 || $page >= $pager_total[$this->pager['element']]) { + $this->pager['current_page'] = 0; } $pager_page_array[$this->pager['element']] = $this->pager['current_page']; } diff --git plugins/views_plugin_cache.inc plugins/views_plugin_cache.inc index b5c9990..4c93c42 100644 --- plugins/views_plugin_cache.inc +++ plugins/views_plugin_cache.inc @@ -253,11 +253,6 @@ class views_plugin_cache extends views_plugin { 'roles' => array_keys($user->roles), 'super-user' => $user->uid == 1, // special caching for super user. ); - foreach (array('exposed_info', 'page', 'sort', 'order') as $key) { - if (isset($_GET[$key])) { - $key_data[$key] = $_GET[$key]; - } - } $this->_results_key = $this->view->name . ':' . $this->display->id . ':results:' . md5(serialize($key_data)); }