# Pagination error with 5 items, works with 10

**URL:** <https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108>\
**Category:** Questions\
**Tags:** v2\
**Created:** [May 13, 2016, 11:00pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108 "2016-05-13T23:00:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxgraphic](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@maxgraphic](https://forum.getkirby.com/u/maxgraphic)\
**Post date:** [May 13, 2016, 11:00pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/1 "2016-05-13T23:00:40Z")

</div>

I’m using the [Range pagination with a link for each page](https://getkirby.com/docs/solutions/blog/pagination) 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();

```

Later:

```
<?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?

Thanks.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [May 14, 2016, 12:51pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/2 "2016-05-14T12:51:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maxgraphic](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@maxgraphic](https://forum.getkirby.com/u/maxgraphic)\
**Post date:** [May 14, 2016, 8:50pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/3 "2016-05-14T20:50:26Z")

</div>

The URLs are for example:

/blog/page:4

However, if I go to:

/blog/?page=4

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 14, 2016, 8:55pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/4 "2016-05-14T20:55:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [May 14, 2016, 8:55pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/5 "2016-05-14T20:55:31Z")

</div>

Hm…  
But `/blog/page:2` does work?

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

---

<div class="post-metadata">

**Author:** ![maxgraphic](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@maxgraphic](https://forum.getkirby.com/u/maxgraphic)\
**Post date:** [May 14, 2016, 9:00pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/6 "2016-05-14T21:00:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 14, 2016, 9:04pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/7 "2016-05-14T21:04:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maxgraphic](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@maxgraphic](https://forum.getkirby.com/u/maxgraphic)\
**Post date:** [May 16, 2016, 3:51am UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/8 "2016-05-16T03:51:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [May 16, 2016, 10:02am UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/9 "2016-05-16T10:02:07Z")

</div>

That makes sense.

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

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

```

Then it shouldn’t confuse Kirby anymore.

---

<div class="post-metadata">

**Author:** ![Dhamu143](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/dhamu143/32/2768_2.png) [@Dhamu143](https://forum.getkirby.com/u/Dhamu143)\
**Post date:** [August 26, 2016, 5:13am UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/10 "2016-08-26T05:13:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:53pm UTC](https://forum.getkirby.com/t/pagination-error-with-5-items-works-with-10/4108/11 "2025-02-06T16:53:17Z")

</div>


