diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 4b299d09..81ad3429 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -1,5 +1,8 @@
CHANGE LOG
+2015-11-06 by newman
+Add proper title to torrent stats page. Update token history to display deleted torrents.
+
2015-10-31 by newman
Add read-only version of site options for mods
diff --git a/sections/stats/torrents.php b/sections/stats/torrents.php
index a5573b70..b0dc15d7 100644
--- a/sections/stats/torrents.php
+++ b/sections/stats/torrents.php
@@ -77,7 +77,7 @@
$Pie->generate();
$Categories = $Pie->url();
-View::show_header();
+View::show_header('Detailed torrent statistics');
?>
diff --git a/sections/userhistory/token_history.php b/sections/userhistory/token_history.php
index 837acded..21a3e51c 100644
--- a/sections/userhistory/token_history.php
+++ b/sections/userhistory/token_history.php
@@ -70,8 +70,8 @@
t.Format,
t.Encoding
FROM users_freeleeches AS f
- JOIN torrents AS t ON t.ID = f.TorrentID
- JOIN torrents_group AS g ON g.ID = t.GroupID
+ LEFT JOIN torrents AS t ON t.ID = f.TorrentID
+ LEFT JOIN torrents_group AS g ON g.ID = t.GroupID
WHERE f.UserID = $UserID
ORDER BY f.Time DESC
LIMIT $Limit");
@@ -106,7 +106,11 @@
foreach ($Tokens as $Token) {
$i = !$i;
list($TorrentID, $GroupID, $Time, $Expired, $Downloaded, $Uses, $Name, $Format, $Encoding) = $Token;
- $Name = "
$Name";
+ if ($Name != '') {
+ $Name = "
$Name";
+ } else {
+ $Name = "(
Deleted torrent $TorrentID)";
+ }
$ArtistName = Artists::display_artists($Artists[$GroupID]);
if ($ArtistName) {
$Name = $ArtistName.$Name;