<table>
	<thead>
		<tr>
			<th>{{ _("Time") }}&nbsp;(ms)</th>
			<th>{{ _("Action") }}</th>
			<th>{{ _('Stacktrace') }}</th>
			<th>{{ _('Query') }}</th>
		</tr>
	</thead>
	<tbody>
		{% for query in queries %}
			<tr class="{{ loop.cycle('djDebugOdd','djDebugEven') }}">
				<td>{{ query.duration|floatformat("2") }}</td>
				<td>
				{% if query.params %}
					{% if query.is_select %}
						<a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}&amp;params={{ query.params|urlencode }}&amp;duration={{ query.duration|floatformat("2")|urlencode }}&amp;hash={{ query.hash }}">SELECT</a><br />
						<a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}&amp;params={{ query.params|urlencode }}&amp;duration={{ query.duration|floatformat("2")|urlencode }}&amp;hash={{ query.hash }}">EXPLAIN</a><br />
						{% if is_mysql %}
							<a class="remoteCall" href="/__debug__/sql_profile/?sql={{ query.raw_sql|urlencode }}&amp;params={{ query.params|urlencode }}&amp;duration={{ query.duration|floatformat("2")|urlencode }}&amp;hash={{ query.hash }}">PROFILE</a><br />
						{% endif %}
					{% endif %}
				{% endif %}
				</td>
				<td>
					{% if query.stacktrace %}
					<div class="djSQLShowStacktraceDiv"><a class="djSQLShowStacktrace" href="#">Toggle Stacktrace</a></div>
					{% endif %}
				</td>
				<td class="syntax">
					<div class="djDebugSqlWrap">
						<div class="djDebugSql">{{ query.sql|safe }}</div>
						{% if query.stacktrace %}
						<div class="djSQLHideStacktraceDiv" style="display:none;">
							<table>
								<tr>
									<th>{{ _("Line") }}</th>
									<th>{{ _("Method") }}</th>
									<th>{{ _("File") }}</th>
									<th>{{ _("Context") }}</th>
								</tr>
								{% for file, line, method, context in query.stacktrace %}
									<tr>
										<td>{{ line }}</td>
										<td><code>{{ method|escape }}</code></td>
										<td><code>{{ file|escape }}</code></td>
										<td><code>{{ context|escape }}</code></td>
									</tr>
								{% endfor %}
							</table>
							{% if query.template_info %}
							<table>
								{% for line in query.template_info.context %}
								<tr>
									<td>{{ line.num }}</td>
									<td><code style="font-family: monospace;{% if line.highlight %}background-color: lightgrey{% endif %}">{{ line.content }}</code></td>
								</tr>
								{% endfor %}
							</table>
							<p><strong>{{ query.template_info.name|default("(unknown)") }}</strong></p>
							{% endif %}
						</div>
						{% endif %}
            <span class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}" style="width:{{ query.width_ratio }}%; left:{{ query.start_offset }}%;"></span>
					</div>
				</td>
			</tr>
		{% endfor %}
	</tbody>
</table>