From c2a468c66d27c7b0dcab8881927dfc34e4d26c45 Mon Sep 17 00:00:00 2001 From: flifloo Date: Sat, 16 Jan 2021 18:31:17 +0100 Subject: [PATCH] Fix pagination --- src/Controller/HomeController.php | 2 +- templates/home/index.html.twig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 55a4425..9840c7f 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -20,7 +20,7 @@ class HomeController extends AbstractController return $this->render('home/index.html.twig', [ 'controller_name' => 'HomeController', 'posts' => $repo->getPublished($page*5, 5), - 'pages' => round(count($repo->getPublished())/5, 0, PHP_ROUND_HALF_UP), + 'pages' => round(count($repo->getPublished())/5, 0, PHP_ROUND_HALF_UP)-1, 'page' => $page ]); } diff --git a/templates/home/index.html.twig b/templates/home/index.html.twig index 41ddbed..cbf0855 100644 --- a/templates/home/index.html.twig +++ b/templates/home/index.html.twig @@ -19,11 +19,11 @@ {% endblock %}