Pagination error with 5 items, works with 10

I’m using the Range pagination with a link for each page sample code with a blog that has 24 visible items:

$articles = $page->children()->visible()->sortBy('Date', 'desc');
if($tag = urldecode(param('tag'))) {
	$articles = $articles->filterBy('tags', $tag, ',');
$articles = $articles->paginate(5);
$pagination = $articles->pagination();


<?php foreach($pagination->range(5) as $paging): ?>
	<li<?php if($pagination->page() == $paging) echo html(' class=active') ?>><a href="<?php echo $pagination->pageURL($paging); ?>"><?php echo $paging; ?></a></li>
<?php endforeach ?>

This shows a range of 5 pages, but clicking the 4th or 5th page gives a “The page has not been found” Kirby error.

However, if I change the pagination to 10 items, it shows 3 pages and they all work fine.

Any idea what’s going on?


That is strange. What do the URLs look like that the pagination generates for the 4th and 5th page?

The URLs are for example:


However, if I go to:


it loads fine. This is making me suspect that there’s some non-Kirby issue going on (this server is hosting a few other things), but could this be a Kirby routing issue?


But the URLs all look the same apart from the number, right? And the first three work, while starting from page 4 they don’t. So if you paginate 3 pages and then have 8 pages, all the pages from 4 on also fail?

But /blog/page:2 does work?

Have you tested the same site on a different server (e.g. a local dev server)?

Right, all the generated URLs are same apart from the number. 1-3 work and higher numbers don’t. I set the pagination to 1 to generate 24 pages and none of the generated URLs after 3 worked.

I haven’t tested it on another server and am waiting to hear back from the dev who maintains the server to see if some other service is interfering.

Yeah, that sounds very much like a server problem, it’s really weird.

As I suspected, this was me not understanding Kirby. In the blog sidebar I was using paginate to limit displayed items. Having multiple paginations on a page unsurprisingly confuses Kirby and changing them to limit resolves the issue.

Sorry for the confusion!

That makes sense.

You can however use multiple paginations on a single page by using a different parameter for the sidebar pagination:

$articles = $articles->paginate(5, array('variable' => 'sidebarpage'));

Then it shouldn’t confuse Kirby anymore.


hello , if your issue gets solved then can you please post your code here , so other can get more idea about that.

i hope you don’t mind