page_offset(); } private function page_offset() { $sql = "SELECT COUNT(*) FROM notes"; $result = $this->db->query($sql); $result = $result->fetch_array(); $this->number_of_pages = ceil($result[0] / $this->notes_per_page); if (isset($_GET['page']) && is_numeric($_GET['page'])) { $this->page = (int) $_GET['page']; } else { throw new notFound(); } if ($this->page > $this->number_of_pages) { throw new notFound(); } if ($this->page < 1) { throw new notFound(); } $this->offset = ($this->page - 1) * $this->notes_per_page; } public function display() { require_once("view/page.php"); } public function display_notes() { echo "