diff --git a/inc/html.php b/inc/html.php
index 02f37eb..569960c 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -275,25 +275,25 @@ EOF;
function rebuildIndexes() {
$page = 0; $i = 0; $htmlposts = '';
$threads = allThreads();
- $pages = ceil(count($threads) / 10) - 1;
+ $pages = ceil(count($threads) / TINYIB_THREADSPERPAGE) - 1;
foreach ($threads as $thread) {
$replies = postsInThreadByID($thread['id']);
-
- $htmlreplies = array();
- for ($j = min(count($replies) - 1, TINYIB_PREVIEWREPLIES); $j > 0; $j--) {
- $htmlreplies[$j] = buildPost($replies[$j], TINYIB_INDEXPAGE);
- }
-
- $thread['omitted'] = max(count($replies) - TINYIB_PREVIEWREPLIES - 1, 0);
+ $thread['omitted'] = max(0, count($replies) - TINYIB_PREVIEWREPLIES - 1);
- $htmlposts .= buildPost($thread, TINYIB_INDEXPAGE) . implode('', $htmlreplies) . "
\n
";
+ $htmlposts .= buildPost($thread, TINYIB_INDEXPAGE);
+
+ for ($j = count($replies) - 1; $j > $thread['omitted']; $j--) {
+ $htmlposts .= buildPost($replies[$j], TINYIB_INDEXPAGE);
+ }
+
+ $htmlposts .= "
\n
";
- if (++$i == 10) {
+ if (++$i >= TINYIB_THREADSPERPAGE) {
$file = ($page == 0) ? 'index.html' : $page . '.html';
writePage($file, buildPage($htmlposts, 0, $pages, $page));
- $page += 1; $i = 0; $htmlposts = '';
+ $page++; $i = 0; $htmlposts = '';
}
}
diff --git a/settings.default.php b/settings.default.php
index 80d9431..9b70388 100644
--- a/settings.default.php
+++ b/settings.default.php
@@ -13,7 +13,8 @@ define('TINYIB_TRIPSEED', ""); // Enter some random text - Used when generating
define('TINYIB_ADMINPASS', ""); // Text entered at the manage prompt to gain administrator access
define('TINYIB_MODPASS', ""); // Moderators only have access to delete posts ["" to disable]
define('TINYIB_DBMODE', "flatfile"); // Choose: flatfile / mysql / sqlite
-define('TINYIB_PREVIEWREPLIES', 0); // Max replies to show on index
+define('TINYIB_PREVIEWREPLIES', 3); // Max replies to show on index
+define('TINYIB_THREADSPERPAGE', 10); // Amount of threads per page on index
// Note: The following only apply when TINYIB_DBMODE is set to mysql
define('TINYIB_DBHOST', "localhost");