<form method="get" class="row align-items-center mb-3">
    {# Keep existing filters/searches #}
    {% for key, value in request.GET.items %}
        {% if key != 'per_page' %}
            <input type="hidden" name="{{ key }}" value="{{ value }}">
        {% endif %}
    {% endfor %}
    <div class="col-auto">
        <label for="per_page" class="form-label mb-0 ">Rows per page:</label>
    </div>
    <div class="col-auto">
        <select name="per_page" id="per_page" class="form-select form-select-sm" onchange="this.form.submit()">
            {% for size in page_sizes %}
                <option value="{{ size }}" {% if request.GET.per_page|stringformat:"s" == size|stringformat:"s" %}selected{% endif %}>{{ size }}</option>
            {% endfor %}
        </select>
    </div>
</form>