<pre><code>{% set sermons = craft.entries.section('sermons').limit(null) %}

{{ sermons|length }}
</code></pre>

<p>By default, the <code>.find()</code> method, which is what gets called when you call <code>craft.entries</code> automatically gets limited to 100. Get round that by using <code>.limit(null)</code></p>

CC BY-SA 3.0
2016-02-11T11:25:35.923Z
I don't want to display them all though, they need pagination. I have 221 entries so I want to count each down from 221 to 1
Steven Grant
CC BY-SA 3.0
2016-02-11T10:22:46.677Z
2016-02-11T10:22:46.677Z
darylknight
<p>You already pass the array keys into the loop as a variable <code>pageInfo</code>. There's a couple of properties you can access from it, see the Craft docs:</p>

<p><a href="https://craftcms.com/docs/templating/paginate#the-pageInfo-variable" rel="nofollow">Templating Reference → <code>{% paginate %}</code></a></p>

<p>Of interest for you is probably these:</p>

<blockquote>
  <p><code>pageInfo.total</code> – The total number of elements across all pages<br>
  <code>pageInfo.currentPage</code> – The current page number.</p>
</blockquote>

<p>It looks like there's no property for the "current element number" and you need to do some math to output it:</p>

<pre><code>{% paginate craft.entries.limit(10) as pageInfo, pageEntries %}    
    {% for entry in pageEntries %}

        {% set index = (pageInfo.currentPage - 1) * 10 + loop.index0 %}

        {{ pageInfo.total - index }} of
        {{ pageInfo.total }}

    {% endfor %}
{% endpaginate %}
</code></pre>

CC BY-SA 3.0
2016-02-11T13:35:47.813Z
No dice on the 2nd page of paginated entries with that update. 1st entry on that page shows 211 when it should be 171
Steven Grant
CC BY-SA 3.0
2016-02-11T13:37:24.447Z
Did you adjust the numbers? I tested the solution and it worked on my install...
carlcs
CC BY-SA 3.0
2016-02-11T13:42:06.977Z
Doh! My limit was different after trying something else
Steven Grant
CC BY-SA 3.0
2016-02-11T10:33:24.180Z
2016-02-11T12:48:05.480Z
2016-02-11T12:48:05.480Z
carlcs
<p>I have this loop</p>

<pre><code>{% paginate craft.entries.section('sermons').limit('10') as pageInfo, entries %}

        {% for sermon in entries %}
        ...
        {{ loop.revindex }}
        ...
        {% endfor %}
</code></pre>

<p>That outputs a count from 10 to 1 - however, there's more entries than just the 10.</p>

<p>How can I output the count of what would be absolute total results?</p>

<pagination><forloop><count>
Reverse count with paginated entries?
# Reverse count with paginated entries?

(Asked by: username_0 on 2016-02-11)

I have this loop
{% paginate craft.entries.section('sermons').limit('10') as pageInfo, entries %}

        {% for sermon in entries %}
        ...
        {{ loop.revindex }}
        ...
        {% endfor %}

That outputs a count from 10 to 1 - however, there's more entries than just the 10.
How can I output the count of what would be absolute total results?

**Tags:** pagination, forloop, count

---

## 2 answers

### Answer by username_2 on 2016-02-11. Score: 4 | Accepted answer

You already pass the array keys into the loop as a variable pageInfo. There's a couple of properties you can access from it, see the Craft docs:
Templating Reference → {% paginate %}
Of interest for you is probably these:

pageInfo.total – The total number of elements across all pages
pageInfo.currentPage – The current page number.

It looks like there's no property for the "current element number" and you need to do some math to output it:
{% paginate craft.entries.limit(10) as pageInfo, pageEntries %}    
    {% for entry in pageEntries %}

        {% set index = (pageInfo.currentPage - 1) * 10 + loop.index0 %}

        {{ pageInfo.total - index }} of
        {{ pageInfo.total }}

    {% endfor %}
{% endpaginate %}

> **Comments:**
> **username_0**: No dice on the 2nd page of paginated entries with that update. 1st entry on that page shows 211 when it should be 171  
> **username_2**: Did you adjust the numbers? I tested the solution and it worked on my install...  
> **username_0**: Doh! My limit was different after trying something else  

---

### Answer by username_1 on 2016-02-11. Score: -1

{% set sermons = craft.entries.section('sermons').limit(null) %}

{{ sermons|length }}

By default, the .find() method, which is what gets called when you call craft.entries automatically gets limited to 100. Get round that by using .limit(null)

> **Comments:**
> **username_0**: I don't want to display them all though, they need pagination. I have 221 entries so I want to count each down from 221 to 1  

---

