{namespace n=Tx_News_ViewHelpers}

<f:if condition="{configuration.insertAbove}">
	<f:render section="paginator" arguments="{pagination: pagination,configuration:configuration}" />
</f:if>

<f:renderChildren arguments="{contentArguments}" />

<f:if condition="{configuration.insertBelow}">
	<f:render section="paginator" arguments="{pagination: pagination,configuration:configuration}" />
</f:if>

<f:section name="paginator">
	<f:if condition="{pagination.numberOfPages} > 1">
		<f:if condition="{settings.list.paginate}">
			<f:if condition="{pagination.previousPage}">
				<f:if condition="{pagination.previousPage} > 1">
					<f:then>
						<n:headerData><link rel="prev" href="<f:widget.uri arguments="{currentPage: pagination.previousPage}" />" /></n:headerData>
					</f:then>
					<f:else>
						<n:headerData><link rel="prev" href="<f:widget.uri />" /></n:headerData>
					</f:else>
				</f:if>
			</f:if>
			<f:if condition="{pagination.nextPage}">
				<n:headerData><link rel="next" href="<f:widget.uri arguments="{currentPage: pagination.nextPage}" />" /></n:headerData>
			</f:if>
		</f:if>

		<!--		
		<p>
			<f:translate key="paginate_overall" arguments="{0:pagination.current,1:pagination.numberOfPages}" />
		</p>
		-->
		<br>
		<div class="clearfix num_bar">

			<f:if condition="{pagination.previousPage}"> 
				<f:if condition="{pagination.previousPage} > 1">
					<f:then>
						<f:widget.link arguments="{currentPage: pagination.previousPage}">
							<i class="fa fa-caret-left"></i>
							<f:translate key="paginate_previous" />
						</f:widget.link> | 
					</f:then>
					<f:else>
						<f:widget.link>
							<i class="fa fa-caret-left"></i>
							<f:translate key="paginate_previous" />
						</f:widget.link> | 
					</f:else>
				</f:if>
			</f:if>
			<f:if condition="{pagination.displayRangeStart} > 1">
				<f:widget.link>1</f:widget.link> | 
			</f:if>
			<f:if condition="{pagination.hasLessPages}">
				.... | 
			</f:if>
			<f:for each="{pagination.pages}" as="page">
				<f:if condition="{page.isCurrent}">
					<f:then>
						<f:widget.link class="current">{page.number}</f:widget.link> | 
					</f:then>
					<f:else>
							<f:if condition="{page.number} > 1">
								<f:then>
									<f:widget.link arguments="{currentPage: page.number}">{page.number}</f:widget.link> | 
								</f:then>
								<f:else>
									<f:widget.link>{page.number}</f:widget.link> | 
								</f:else>
							</f:if>
					</f:else>
				</f:if>
			</f:for>
			<f:if condition="{pagination.hasMorePages}">
				.... | 
			</f:if>
			<f:if condition="{pagination.displayRangeEnd} < {pagination.numberOfPages}">
				<f:widget.link arguments="{currentPage: pagination.numberOfPages}">{pagination.numberOfPages}</f:widget.link>
			</f:if>
			<f:if condition="{pagination.nextPage}">
				<f:widget.link arguments="{currentPage: pagination.nextPage}">
					<f:translate key="paginate_next" />
					<i class="fa fa-caret-right"></i>
				</f:widget.link>
			</f:if>

		</div>

	</f:if>
</f:section>
