<p>Not sure about a load of math, but if you've got <code>pageInfo</code> setup like in the <a href="https://craftcms.com/docs/templating/paginate" rel="nofollow noreferrer">docs</a>, should be something like this:</p>

<pre><code>{% set totalPages = pageInfo.totalPages %}
{% set itemsPerPage = 20 %}
{% set currentPage = pageInfo.currentPage %}
{% set totalItems = pageInfo.total %}

{% set wholeItems = (totalPages - 1) * itemsPerPage %}
{% set remainderItems = totalItems - wholeItems %}

{% if currentPage == totalPages - 1 %}
    Next {{ remainderItems }} items.
{% else %}
    Next {{ itemsPerPage }} items.
{% endif %}
</code></pre>

CC BY-SA 3.0
2017-01-21T21:57:09.997Z
Yup, that's what I meant by maths!  juts wondered if there was an easier way, but I'll roll with your suggestion! Thanks!
shorn
CC BY-SA 3.0
2017-01-21T18:58:10.247Z
2017-01-24T03:29:14.750Z
2017-01-24T03:29:14.750Z
Brad Bell
<p>Just a quicky regarding pagination. 
I have a paginated results list with a limit of 20 results in a page. </p>

<p>I'm wondering how I owuld go about making a pagination that shows the number of results on the next page. </p>

<p>i.e. 
If I have 105 results, the pagination link says 'next 20 results', up to the fifth page, which would then say 'next 5 results'.</p>

<p>Not sure if there is an easier way to do it other than a load of maths to work it out. </p>

<p>Thanks!</p>

<entries><pagination>
Pagination, display 'Next 20 Results' etc
# Pagination, display 'Next 20 Results' etc

(Asked by: username_0 on 2017-01-21)

Just a quicky regarding pagination.
I have a paginated results list with a limit of 20 results in a page.

I'm wondering how I owuld go about making a pagination that shows the number of results on the next page.

i.e.
If I have 105 results, the pagination link says 'next 20 results', up to the fifth page, which would then say 'next 5 results'.

Not sure if there is an easier way to do it other than a load of maths to work it out.

Thanks!

**Tags:** entries, pagination


---

## 1 answers

### Answer by username_1 on 2017-01-21. Score: 1 | Accepted answer

Not sure about a load of math, but if you've got pageInfo setup like in the docs, should be something like this:
{% set totalPages = pageInfo.totalPages %}
{% set itemsPerPage = 20 %}
{% set currentPage = pageInfo.currentPage %}
{% set totalItems = pageInfo.total %}

{% set wholeItems = (totalPages - 1) * itemsPerPage %}
{% set remainderItems = totalItems - wholeItems %}

{% if currentPage == totalPages - 1 %}
    Next {{ remainderItems }} items.
{% else %}
    Next {{ itemsPerPage }} items.
{% endif %}

> **Comments:**
> **username_0**: Yup, that's what I meant by maths!  juts wondered if there was an easier way, but I'll roll with your suggestion! Thanks!  

---

