<xf:title>{{ phrase('image_proxy_log') }}</xf:title>

<xf:form action="{{ link('logs/image-proxy') }}" class="block">
	<div class="block-container">
		<div class="block-body block-row">
			<xf:textbox name="url" value="{$filters.url}"
				placeholder="{{ phrase('url_contains...') }}"
				class="input--inline" />
			<span>
				{{ phrase('ordered_by:') }}
				<xf:select name="order" value="{{ $filters.order ? $filters.order : 'last_request_date' }}"
					class="input--inline">
					<xf:option value="last_request_date">{{ phrase('last_requested') }}</xf:option>
					<xf:option value="first_request_date">{{ phrase('first_requested') }}</xf:option>
					<xf:option value="views">{{ phrase('hits') }}</xf:option>
					<xf:option value="file_size">{{ phrase('size') }}</xf:option>
				</xf:select>
			</span>

			<xf:button type="submit">{{ phrase('go') }}</xf:button>
		</div>
	</div>
</xf:form>

<xf:if is="$entries is not empty">
	<div class="block">
		<div class="block-container">
			<div class="block-body">
				<xf:datalist data-xf-init="responsive-data-list">
					<xf:datarow rowtype="header">
						<xf:cell colspan="2">{{ phrase('image') }}</xf:cell>
						<xf:cell>{{ phrase('hits') }}</xf:cell>
					</xf:datarow>
					<xf:foreach loop="$entries" value="$entry">
						<xf:datarow>
							<xf:cell
								class="dataList-cell--min dataList-cell--alt dataList-cell--image dataList-cell--imageMediumWide"
								href="{{ link('logs/image-proxy', $entry) }}" overlay="true">
								<xf:if is="$entry.isValid()">
									<img src="{{ link('logs/image-proxy/image', $entry) }}" alt="" />
								<xf:else />
									<span class="dataList-imagePlaceholder"></span>
								</xf:if>
							</xf:cell>
							<xf:cell href="{{ link('logs/image-proxy', $entry) }}" overlay="true">
								<div class="dataList-textRow">{$entry.url}</div>
								<div class="dataList-subRow">
									<ul class="listInline listInline--bullet">
										<xf:if is="{$entry.file_size}"><li>{{ phrase('size:') }} {$entry.file_size|file_size}</li></xf:if>
										<li>{{ phrase('first_requested:') }} <xf:date time="{$entry.first_request_date}" /></li>
										<li>{{ phrase('last_requested:') }} <xf:date time="{$entry.last_request_date}" /></li>
									</ul>
								</div>
							</xf:cell>
							<xf:cell href="{{ link('logs/image-proxy', $entry) }}" class="dataList-cell--min"
								overlay="true">
								{$entry.views|number}
							</xf:cell>
						</xf:datarow>
					</xf:foreach>
				</xf:datalist>
			</div>
			<div class="block-footer">
				<span class="block-footer-counter">{{ display_totals($entries, $total) }}</span>
			</div>
		</div>
		<xf:pagenav page="{$page}" perpage="{$perPage}" total="{$total}"
			link="logs/image-proxy" params="{$filters}"
			wrapperclass="block-outer block-outer--after" />
	</div>
<xf:else />
	<div class="blockMessage">{{ phrase('no_entries_have_been_logged') }}</div>
</xf:if>