post = new Post(); } public function index(): void { $page = max(1, (int) ($_GET['page'] ?? 1)); $offset = ($page - 1) * self::POSTS_PER_PAGE; $posts = $this->post->findAllPaginated(self::POSTS_PER_PAGE, $offset); $totalPosts = $this->post->countAll(); $totalPages = max(1, (int) ceil($totalPosts / self::POSTS_PER_PAGE)); $content = __DIR__ . '/../Views/gallery/index.php'; include __DIR__ . '/../Views/layouts/main.php'; } }