How to get the number of pages in a view template? I'm trying to get the number of total "pager" pages with a view by using the views-mini-pager.html.twig. Here is my code so far...

{% if items.previous or items.next %}
&lt;nav class="pagination" role="navigation"&gt;
            {% if items.previous %}
                {% if items.current %}
                    {% trans %}
                    &lt;span class="page-number"&gt;Page {{ items.current }}&lt;/span&gt;
                    {% endtrans %}
                {% endif %}
                    &lt;a class="newer-posts" href="{{ items.previous.href }}"&gt;&lt;span aria-hidden="true"&gt;←&lt;/span&gt;{{ items.previous.text|default('‹‹'|t) }}&lt;/a&gt;
            {% endif %}
            {% if items.next %}
                {% if items.current %}
                    {% if items.previous %}
                    {% else %}
                        {% trans %}
                        &lt;span class="page-number"&gt;Page {{ items.current }}&lt;/span&gt;
                        {% endtrans %}
                    {% endif %}
                {% endif %}
                &lt;a class="older-posts" href="{{ items.next.href }}"&gt;{{ items.next.text|default('››'|t) }}&lt;span aria-hidden="true"&gt;→&lt;/span&gt;&lt;/a&gt;
            {% endif %}
    &lt;/nav&gt;
{% endif %}


I want to have something like this



And currently, I can only get the current number page which ends up like this ...



I have searched for the variables inside of views-mini-pager.html.twig and I have not found the number of pages. 

My question is...


How can I get the number of pages total? So I can display it at views-mini-pager.html.twig


For instance, if I view is divided into three pages I want to display "Page 1 of 3"
Mini Pager doesn't give you that information. It's designed to not execute a count query. It just knows that there's at least one additional result (because it actually queries 21 if you show 21).