<?php

	$title = 'Рейтинг кланов';
	$paginate = TRUE;

	require_once './protected/sys.php';


	$c = 10;
	$k_post = $db->rows("SELECT id FROM clans", array());
	$k_page = k_page($k_post, $c);
	$page = page($k_page);
	$start = $c * $page - $c;

	$db->offEmulate();

	$clans = $db->fetchAll("SELECT id, name FROM clans ORDER BY id DESC LIMIT ?,?", array($start, $c));

?>

<?php if(!$clans): ?>
Кланов пока нет
<?php else: ?>

<?php foreach($clans as $clan): ?>

<a class="menu" href="/clans/clan?id=<?= $clan['id'] ?>">
	<?= htmlspecialchars($clan['name']) ?>
</a>

<?php endforeach; ?>
<?php endif; ?>

</div>

<?php if($k_page > 1): ?>

<div class="menu">
	<div class="hr_arr mt2 mb2 mlr10">
		<div class="alf">
			<div class="art">
				<div class="acn">
				</div>
			</div>
		</div>
	</div>
<center>

<?php str('?', $k_page, $page) ?>

</center>

<div class="hr_arr mt2 mb2 mlr10">
		<div class="alf">
			<div class="art">
				<div class="acn">
				</div>
			</div>
		</div>
	</div>

</div>

<?php

	endif;
	require_once $config['root'] .'/protected/footermain.php';

?>