} else { // no $label = ''; } // Add to array $sticky_array[] = array('topic_title' => htmlspecialchars($sticky->topic_title), 'topic_id' => $sticky->id, 'topic_created_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_date), $time_language), 'topic_created' => date('d M Y, H:i', $sticky->topic_date), 'topic_created_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'topic_created_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'views' => $sticky->topic_views, 'locked' => $sticky->locked, 'posts' => $replies, 'last_reply_avatar' => $last_reply_avatar, 'last_reply_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_reply_date), $time_language), 'last_reply' => date('d M Y, H:i', $sticky->topic_reply_date), 'last_reply_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'last_reply_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'label' => $label); } // Clear out variables $stickies = null; $sticky = null; // Latest discussions // PAGINATION // Set current page and number of records $pagination->setCurrent($p); $pagination->setTotal(count($topics)); $pagination->alwaysShowPagination(); // Get number of topics we should display on the page $paginate = PaginateArray($p); $n = $paginate[0]; $f = $paginate[1]; // Get the number we need to finish on ($d) if (count($topics) > $f) { $d = $p * 10; } else { $d = count($topics) - $n; $d = $d + $n; } $template_array = array(); // Get a list of all topics from the forum, and paginate while ($n < $d) { // Get number of replies to a topic