{% if posts.pagination.pages is not empty %}
    <div class="pagination-block">
        <ul class="pagination">
            {% if pagination.pages|first and pagination.pages|first.current != true %}
                <li class="first btn">
                    <a href="{{ pagination.pages|first.link }}">First</a>
                </li>
            {% else %}
                <li class="first btn disabled">
                    <a>First</a>
                </li>
            {% endif %}

            {% if pagination.prev %}
                <li class="prev btn">
                    <a href="{{ pagination.prev.link }}">Previous</a>
                </li>
            {% else %}
                <li class="prev btn disabled">
                    <a>Previous</a>
                </li>
            {% endif %}

            {% for page in pagination.pages %}
                {% if page.link %}
                    <li>
                        <a href="{{ page.link }}" class="{{ page.class }}">{{ page.title }}</a>
                    </li>
                {% else %}
                    <li class="current">
                        <a class="{{ page.class }}">{{ page.title }}</a>
                    </li>
                {% endif %}
            {% endfor %}

            {% if pagination.next %}
                <li class="next btn">
                    <a href="{{ pagination.next.link }}">
                        Next
                    </a>
                </li>
            {% else %}
                <li class="next btn disabled">
                    <a>
                        Next
                    </a>
                </li>
            {% endif %}
            {% if pagination.pages|last and pagination.pages|last.current != true %}
                <li class="last btn">
                    <a href="{{ pagination.pages|last.link }}">Last</a>
                </li>
            {% else %}
                <li class="last btn disabled">
                    <a>Last</a>
                </li>
            {% endif %}
        </ul>
    </div>
{% endif %}
