{% import 'snippets/links.jinja' as links %}


{% if charts is undefined %}
	{% set charts = dbc.get_charts_tracks(filterkeys,limitkeys) %}
{% endif %}

{% set charts_14 = charts | fixlength(14) %}
{% set charts_cycler = cycler(*charts_14) %}


<table class="tiles_top"><tr>
{% for segment in range(3) %}
	<td>
	{% set segmentsize = segment+1 %}
	<table class="tiles_{{ segmentsize }}x{{ segmentsize }} tiles_sub">
		{% for row in range(segmentsize) -%}
			<tr>
				{% for col in range(segmentsize) %}
					{% set entry = charts_cycler.next() %}
					{% if entry is not none %}
						{% set track = entry.track %}
						{% set rank = entry.rank %}
						<td>
							<a href="{{ links.url(track) }}">
							<div style='background-image:url("{{ utilities.get_track_image(track,fast=True) }}")'>
								<span class='stats'>#{{ rank }}</span> <span>{{ track.title }}</span>
							</div>
							</a>
						</td>
					{% else -%}
						<td></td>
					{%- endif %}
				{%- endfor -%}
			</tr>
		{%- endfor %}
	</table>
</td>
{% endfor %}
</tr></table>
