{% extends "base.html" %}
{% block content %}
    {% for review in reviews %}
        {% include '_review.html' %}
    {% endfor %}

    <div align="center">
    {% if reviews.has_other_pages %}

      {% if reviews.has_previous %}
        <a class="btn btn-outline-info mb-4" href="?page=1">First</a>
        <a class="btn btn-outline-info mb-4" href="?page={{ reviews.previous_page_number }}">Previous</a>
      {% endif %}

      {% for num in reviews.paginator.page_range %}
        {% if reviews.number == num %}
          <a class="btn btn-info mb-4" href="?page={{ num }}">{{ num }}</a>
        {% elif num > reviews.number|add:'-3' and num < reviews.number|add:'3' %}
          <a class="btn btn-outline-info mb-4" href="?page={{ num }}">{{ num }}</a>
        {% endif %}
      {% endfor %}

      {% if reviews.has_next %}
        <a class="btn btn-outline-info mb-4" href="?page={{ reviews.next_page_number }}">Next</a>
        <a class="btn btn-outline-info mb-4" href="?page={{ reviews.paginator.num_pages }}">Last</a>
      {% endif %}

    {% endif %}
    </div>

{% endblock content %}