printf("<br /><h3 id=\"mainCategoryTitle\" key=\"%s\">%s</h3>", $_GET['maincc'], $inv_maincategory->prepareDescription());
 } else {
     if (!isset($_GET['page']) || $_GET['page'] == 1) {
         $first = 0;
         $last = 100;
     } else {
         $first = ($_GET['page'] - 1) * 100;
         $last = $first + 100 - 1;
     }
     //$inv_counter = count(Inv_item::findAll());
     $inv_counter = 0;
     $temps = $db->query('SELECT count(*) as num FROM inv_items');
     foreach ($temps as $row) {
         $inv_counter = $row['num'];
     }
     $inv_items = Inv_item::findAllLimit($first, 100);
     //echo "FIRST:". $first ."LAST:". $last;
     $times = ceil($inv_counter / 100);
     //$times = 30;
     echo "<h3>All results</h3>";
     if ($times < 2) {
         echo "<span id=\"pagination\"><a href=\"inventory.php?maincc=all\">First </a>";
         echo "<a href=\"inventory.php?maincc=all&page={$times}\">Last</a></span>";
     } else {
         echo "<span id=\"pagination\"><a href=\"inventory.php?maincc=all\">First </a>";
         for ($i = 1; $i < $times; $i++) {
             echo "<a href=\"inventory.php?maincc=all&page={$i}\">{$i} </a></span>";
         }
         echo "<a href=\"inventory.php?maincc=all&page={$times}\">Last</a></span>";
     }
 }