From edbb8943d23aa545190b713692a5fe185fe80a2a Mon Sep 17 00:00:00 2001
From: Shish <shish@shishnet.org>
Date: Sun, 12 Feb 2012 07:30:16 +0000
Subject: [PATCH] count pages by the aliased-to tag, not what the user typed

---
 core/imageboard.pack.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php
index fad0ad73..c9ad7633 100644
--- a/core/imageboard.pack.php
+++ b/core/imageboard.pack.php
@@ -157,9 +157,10 @@ class Image {
 			return $total;
 		}
 		else if(count($tags) == 1 && !preg_match("/[:=><]/", $tags[0])) {
+			$term = Tag::resolve_alias($tags[0]);
 			return $database->get_one(
 				$database->engine->scoreql_to_sql("SELECT count FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)"),
-				array("tag"=>$tags[0]));
+				array("tag"=>$term));
 		}
 		else {
 			$querylet = Image::build_search_querylet($tags);