<?php

defined('_IN_JOHNCMS') or die('Error: restricted access');
$kmess = '15';
echo '<div class="phdr"><center>Yangi maqolalar</center></div>';
echo '<div class="menu">';

$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `library_texts` WHERE `time` AND `premod`=1"), 0);
$page = $page >= ceil($total / $kmess) ? ceil($total / $kmess) : $page;
$start = $page == 1 ? 0 : ($page - 1) * $kmess;
$sql = mysql_query("SELECT `id`, `name`, `time`, `uploader`, `uploader_id`, `count_views`, `comments`, `count_comments`, `cat_id`, `announce` FROM `library_texts` WHERE `premod`=1 ORDER BY `time` DESC LIMIT " . $start . "," . $kmess);
$nav = ($total > $kmess) ? '<div class="menu"><center>' . functions::display_pagination('?act=new&amp;', $start, $total, $kmess) . '</center></div>' : '';
if ($total) {
    $i = 0;
    while ($row = mysql_fetch_assoc($sql)) {
        echo '<a href="' . $set['homeurl'] . '/library/index.php?id=' . $row['id'] . '"><img src="/ico/feed.png"> ' . functions::checkout($row['name']) . '</a><hr>';

    }
}

echo '</div>';
echo $nav;
?>
