diff --git a/plugins/views_plugin_pager.inc b/plugins/views_plugin_pager.inc index ab45863..0217f4d 100644 --- a/plugins/views_plugin_pager.inc +++ b/plugins/views_plugin_pager.inc @@ -50,7 +50,7 @@ class views_plugin_pager extends views_plugin { * most pagers will not need to override this method. */ public function get_items_per_page() { - return isset($this->options['items_per_page']) ? $this->options['items_per_page'] : 0; + return isset($this->options['items_per_page']) ? (int) $this->options['items_per_page'] : 0; } /** @@ -59,7 +59,7 @@ class views_plugin_pager extends views_plugin { * This is mostly used for things that will override the value. */ public function set_items_per_page($items) { - $this->options['items_per_page'] = $items; + $this->options['items_per_page'] = (int) $items; } /** @@ -69,14 +69,14 @@ class views_plugin_pager extends views_plugin { * so few pagers will need to override this method. */ public function get_offset() { - return isset($this->options['offset']) ? $this->options['offset'] : 0; + return isset($this->options['offset']) ? (int) $this->options['offset'] : 0; } /** * Set the page offset, or how many items to skip. */ public function set_offset($offset) { - $this->options['offset'] = $offset; + $this->options['offset'] = (int) $offset; } /** diff --git a/plugins/views_plugin_pager_full.inc b/plugins/views_plugin_pager_full.inc index fff7691..578bebe 100644 --- a/plugins/views_plugin_pager_full.inc +++ b/plugins/views_plugin_pager_full.inc @@ -252,7 +252,7 @@ class views_plugin_pager_full extends views_plugin_pager { public function query() { if ($this->items_per_page_exposed()) { if (!empty($_GET['items_per_page']) && $_GET['items_per_page'] > 0) { - $this->options['items_per_page'] = $_GET['items_per_page']; + $this->options['items_per_page'] = (int) $_GET['items_per_page']; } elseif (!empty($_GET['items_per_page']) && $_GET['items_per_page'] == 'All' && $this->options['expose']['items_per_page_options_all']) { $this->options['items_per_page'] = 0; @@ -260,16 +260,15 @@ class views_plugin_pager_full extends views_plugin_pager { } if ($this->offset_exposed()) { if (isset($_GET['offset']) && $_GET['offset'] >= 0) { - $this->options['offset'] = $_GET['offset']; + $this->options['offset'] = (int) $_GET['offset']; } } - $limit = $this->options['items_per_page']; - $offset = $this->current_page * $this->options['items_per_page'] + $this->options['offset']; + $limit = $this->get_items_per_page(); + $offset = $this->current_page * $limit + $this->get_offset(); if (!empty($this->options['total_pages'])) { if ($this->current_page >= $this->options['total_pages']) { - $limit = $this->options['items_per_page']; - $offset = $this->options['total_pages'] * $this->options['items_per_page']; + $offset = $this->options['total_pages'] * $limit; } }