{% if num_pages > 1 %}
  <div class="row px-3">
    <nav class="col-12" aria-label="Page navigation example">
      <ul class="pagination justify-content-end">
        {% if page.has_previous %}
          <li class="page-item">
            <a class="page-link" href="?page={{ page.previous_page_number }}" aria-label="Previous">
            <span aria-hidden="true">&laquo;</span>
            </a>
          </li>
        {% endif %}
        {% for i in pages %}
          <li class="page-item {% if i == page_number %} active {% endif %}"><a class="page-link" href="?page={{ i }}">{{i}}</a></li>
        {% endfor %}
        {% if page.has_next %}
          <li class="page-item">
            <a class="page-link" href="?page={{ page.next_page_number }}" aria-label="Next">
              <span aria-hidden="true">&raquo;</span>
            </a>
          </li>
        {% endif %}
      </ul>
    </nav>
  </div>
{% endif %}