{% if pagination_object.has_prev %}
<a href="{{ url_for(request.endpoint, page=pagination_object.prev_num) }}">
    <button class="btn btn-primary">Previous</button>
</a>
{% else %}
<button class="btn btn-secondary">Previous</button>
{% endif %}
{% if pagination_object.has_next %}
<a href="{{ url_for(request.endpoint, page=pagination_object.next_num) }}">
    <button class="btn btn-primary">Next</button>
</a>
{% else %}
<button class="btn btn-secondary">Next</button>
{% endif %}