public function total_pages($limit = null, $offset = null, $total = null) { $this->do_hook('total_pages'); if (null === $limit) { $limit = $this->limit; } if (null === $offset) { $offset = $this->offset; } if (null === $total) { $total = $this->total_found(); } $total_pages = ceil(($total - $offset) / $limit); return $total_pages; }