{% set templateTitle = 'Recent searches'|trans %}
{{ moduleHeader('user', templateTitle, true, true) }}

<h3>{{ templateTitle }}</h3>

<table class="table table-bordered table-striped">
    <colgroup>
        <col id="cSearchKeywords" />
        <col id="cAmountOfSearches" />
        <col id="cDateOfLastSearch" />
    </colgroup>
    <thead>
        <tr>
            <th id="hSearchKeywords" scope="col">{% trans %}Search keywords{% endtrans %}</th>
            <th id="hAmountOfSearches" scope="col">{% trans %}Number of searches{% endtrans %}</th>
            <th id="hDateOfLastSearch" scope="col">{% trans %}Date of last search{% endtrans %}</th>
        </tr>
    </thead>
    <tbody>
        {% for recentSearch in paginator.results %}
            <tr>
                <th id="hSearchRow{{ loop.index }}" scope="row" headers="hSearchKeywords">
                    <a href="{{ path('zikulasearchmodule_search_execute', {q: recentSearch.search}) }}">{{ recentSearch.search|replace({' ': ', '}) }}</a>
                </th>
                <td headers="hSearchRow{{ loop.index }} hAmountOfSearches">{{ recentSearch.count }}</td>
                <td headers="hSearchRow{{ loop.index }} hDateOfLastSearch">{{ recentSearch.date.timestamp|format_date('short') }}</td>
            </tr>
        {% else %}
            <tr class="table-info"><td colspan="3" class="text-center">{% trans %}No items found.{% endtrans %}</td></tr>
        {% endfor %}
    </tbody>
</table>
{{ include(paginator.template) }}
