query->getInt('page', 1); $posts = $repository->findPaginatedPosts($page, self::POSTS_PER_PAGE); $maxPage = ceil($posts->count() / self::POSTS_PER_PAGE); return $this->render('post/index.html.twig', [ 'posts' => $posts, 'maxPage' => $maxPage, 'page' => $page, ]); } }