{% macro record_status_filter(key, search, active, statuses, totals, clear_url=none) %}
{% set selected = (statuses|reject('equalto', '')|list or DISPLAY_STATUSES) if active else [] %}
{% set caption = 'All records' if not selected else ('All changes' if selected|length == 3 else (selected[0] if selected|length == 1 else selected|length ~ ' statuses')) %}
{% endmacro %}