threads > $threads_per_page) { $totalPages = ceil($forum->threads / $threads_per_page); if (isset($_GET['start'])) { $curPage = floor($_GET['start'] / $threads_per_page); } else { $curPage = 0; } if ($totalPages == 2) { $pages = array(0, 1); } else { $pages = array(0, 1, 2); } for ($i = -1 ; $i <= 1 ; $i++) { if ($curPage + $i > 0 && $curPage + $i < $totalPages - 1) { array_push($pages, $curPage + $i); } } for ($i = -3 ; $i <= -1 ; $i++) { if ($totalPages + $i > 0) { array_push($pages, $totalPages + $i); } } $pages = array_unique($pages); natsort($pages); $pages = array_values($pages); $gotoStr = '

Go to page '; if ($curPage == 0) { $gotoStr .= '1 '; } else { $gotoStr .= '1'; } for ($i = 1 ; $i < count($pages)-1 ; $i++) { if ($curPage == $pages[$i]) { $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; $gotoStr .= $pages[$i]+1; } else { $gotoStr .= ($i > 0 && $pages[$i-1] == $pages[$i] - 1)?', ':' ... '; $gotoStr .= ''; } } if ($curPage == $totalPages-1) { $gotoStr .= $totalPages; } else { $gotoStr .= ', '; $gotoStr .= 'is_helpdesk) { start_forum_table(array("Question", "Answers")); } else { start_forum_table(array("", "Threads", "Posts", "Author", "Views", "Last post")); } $sticky_first = !$logged_in_user->ignore_sticky_posts; $threads = getThreads($forum->id, $start, $threads_per_page, $sort_style, 0, $sticky_first); $n = 0; while ($thread = mysql_fetch_object($threads)) { $user = lookup_user_id($thread->owner); $logged_in_user=getThreadLastVisited($logged_in_user,$thread); $unread = ($thread->timestamp>$logged_in_user->thread_last_visited); echo " "; if (!$category->is_helpdesk) { //Show thread icons if in forum: echo ""; $first_post = getFirstPost($thread->id); if ($first_post->score*$first_post->votes>$logged_in_user->high_rating_threshold) { echo "\"Emphasized"; } if ($first_post->score*$first_post->votes<$logged_in_user->low_rating_threshold) { echo "\"Filtered"; } if ($unread && !$thread->sticky) { echo "\"Unread"; } elseif($unread) { echo "\"Unread"; } elseif($thread->sticky) { echo "\"Sticky\""; } echo ""; } $titlelength = 48; $title = cleanup_title($thread->title); if (strlen($title) > $titlelength) { $title = substr($title,0,$titlelength)."..."; } echo "id, "\">", $title, "
"; $n = ($n+1)%2; if ($category->is_helpdesk) { $first_post = getFirstPost($thread->id); $excerpt = sub_sentence($first_post->content, ' ', EXCERPT_LENGTH, true); echo strip_tags(stripslashes($excerpt)); $na = $thread->sufferers + 1; $x = time_diff_str($first_post->timestamp, time()); echo "
Asked $x; asked $na times"; } echo ""; $x = time_diff_str($thread->timestamp, time()); if ($category->is_helpdesk) { if ($thread->replies == 0) $x = "---"; echo " Total: $thread->replies
Last: $x "; } else { echo " ", $thread->replies+1, "

", user_links($user), "
", $thread->views, " ", $x, " "; } echo ""; } end_forum_table(); if ($forum->threads > $n) { echo $gotoStr; } } ?>