Pagination not working

Hello everyone, I made 2 paginations on the same page, one is working and the other not. I don’t really understand why. There two paginations are in a php loop, one in “if” the other in “else”, there are completly similar except the name of the function in the controller. The pagination display the number of page, but the next page don’t work.

the url is :http://localhost/imfusio/fr/bibliotheque/page;2, and I have my error page. First I was wondering if it means that my page don’t have children, but the function in my controller is working.

  ->children()
  ->shuffle()
  ->listed()
  ->when($filterBy, function ($filterBy) {
    return $this->filterBy('type', $filterBy);
  })
  ->paginate(2);

the other one working url is : http://localhost/imfusio/fr/bibliotheque/page;2?q=article

Can anyone help me with her fresh eyes ?

This is my code :

My pagination in templates/articles.php:

<div class="row">
        <?php if ($paginatepublications->hasNextPage()) : ?>
          <span class="align-middle"><?= $paginatepublications->page() ?> / <?= $paginatepublications->pages() ?></span>
        <?php endif ?>
        <nav>
          <div class="col-sm-6">
            <?php if ($paginatepublications->hasPrevPage()) : ?>
              <a class="prev" href="<?= $paginatepublications->prevPageUrl() ?>" aria-label="Go to previous page"><?= svg('assets/images/arrow-left.svg') ?></a>
            <?php endif ?>
          </div>

          <div class="col-sm-6 .next" style="text-align: right;">
            <?php if ($paginatepublications->hasNextPage()) : ?>
              <a class="next" href="<?= $paginatepublications->nextPageUrl() ?>" aria-label="Go to next page"><?= svg('assets/images/arrow-right.svg') ?></a>
            <?php endif ?>
          </div>
        </nav>
      </div>

My controller in controllers/articles.php :

  $publications = $page
  ->children()
  ->shuffle()
  ->listed()
  ->when($filterBy, function ($filterBy) {
    return $this->filterBy('type', $filterBy);
  })
  ->paginate(2);

  return [
    'results' => $results,
    'paginateresults' => $results->pagination(), 

    'publications' => $publications,
    'paginatepublications' => $publications->pagination(),  
  ];

Thank you
Clara

If you use multiple paginations in the same page, they have to use different parameters, e.g. see here (while this is an old post referring to Kirby 2, it is the same in Kirby 3):

1 Like

Thank you @texnixe !