{% if context_history is defined and context_history is not none %}

{{ t.context_history }}

{% for item in context_history['items'] %}{% else %}{% endfor %}
{{ t.context_query }}{{ t.context_result }}{{ t.context_selected }}{{ t.context_budget }}{{ t.context_total_duration }}{{ t.context_finished_at }}
{% if item.query_text is not none %}{% if item.query_text|length > 160 %}
{{ item.query_text[:160] }}…
{{ item.query_text }}
{% else %}
{{ item.query_text if item.query_text else t.context_query_empty }}
{% endif %}{% else %}{{ t.context_query_not_recorded }}{% endif %}
{{ t['context_' ~ item.status] }}{% if item.error_code and item.status in ['ready', 'empty'] %}{{ t.context_degraded }}{% endif %}{{ item.selected_count if item.selected_count is not none else t.unknown_value }}{{ item.content_bytes if item.content_bytes is not none else t.unknown_value }} / {{ item.requested_max_bytes }} B{{ '%.2f'|format(item.duration_ms) }} ms{{ item.finished_at|display_time }}{{ t.context_view }}
{{ t.context_history_empty }}
{% if context_history.next_cursor %}{% endif %} {% if request.query_params.get('diagnostic_cursor') %}{% endif %}
{% endif %}