diff --git a/filelist.php b/filelist.php
index f9792c989..08a2584ba 100644
--- a/filelist.php
+++ b/filelist.php
@@ -34,6 +34,32 @@ if (!$row = DB()->fetch_row($sql)) {
bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
}
+// Previous/next topic links
+$sql = '
+ (SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id < ' . $topic_id . ' ORDER BY topic_id DESC LIMIT 1)
+ UNION
+ (SELECT topic_id FROM ' . BB_BT_TORRENTS . ' WHERE topic_id >= ' . $topic_id . ' ORDER BY topic_id ASC LIMIT 2)
+ ORDER BY topic_id ASC';
+
+if (!$topics = DB()->fetch_rowset($sql)) {
+ bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
+}
+$topic_ids = array_column($topics, 'topic_id');
+
+$current_index = array_search($topic_id, $topic_ids);
+if ($current_index === false) {
+ bb_die($lang['INVALID_TOPIC_ID_DB'], 404);
+}
+
+$prev_topic_id = $topic_ids[$current_index - 1] ?? $topic_id;
+$next_topic_id = $topic_ids[$current_index + 1] ?? $topic_id;
+
+$template->assign_vars([
+ 'U_NEXT_TOPIC' => "filelist.php?t=$next_topic_id",
+ 'U_PREV_TOPIC' => "filelist.php?t=$prev_topic_id",
+]);
+unset($prev_topic_id, $next_topic_id, $current_index, $topic_ids, $topics);
+
// Protocol meta
$meta_v1 = !empty($row['info_hash']);
$meta_v2 = !empty($row['info_hash_v2']);
diff --git a/library/language/source/main.php b/library/language/source/main.php
index 65fd05fd1..8ccab797c 100644
--- a/library/language/source/main.php
+++ b/library/language/source/main.php
@@ -1733,6 +1733,8 @@ $lang['EMPTY_ATTACH_ID'] = 'Missing file identifier!';
$lang['TOR_NOT_FOUND'] = 'File is missing on the server!';
$lang['ERROR_BUILD'] = 'The content of this torrent file can not be viewed on the site (it was not possible to build a list of files)';
$lang['TORFILE_INVALID'] = 'Torrent file is corrupt';
+$lang['PREV_RELEASE'] = 'Previous release';
+$lang['NEXT_RELEASE'] = 'Next release';
// Profile
$lang['WEBSITE_ERROR'] = 'The "site" may contain only http://sitename';
diff --git a/styles/templates/default/filelist.tpl b/styles/templates/default/filelist.tpl
index 9e6bc4eb4..4f7bcc2b9 100644
--- a/styles/templates/default/filelist.tpl
+++ b/styles/templates/default/filelist.tpl
@@ -6,6 +6,11 @@
+