IIRC somebody already reported this here. Can't remember if this has been already fixed, are you using the last version of MyBB? If so, it hasn't probably been fixed then.
if($fpermissions['canviewthreads']!=0){// How many posts are there?
if(($datecut>0&&$datecut!=9999)||isset($fpermissions['canonlyviewownthreads'])&&$fpermissions['canonlyviewownthreads']==1){$query=$db->simple_select("threads","COUNT(tid) AS threads","fid = '$fid' $useronly$visibleonly$datecutsql$prefixsql");$threadcount=$db->fetch_field($query,"threads");}else{$query=$db->simple_select("forums","threads, unapprovedthreads, deletedthreads","fid = '{$fid}'",array('limit'=>1));$forum_threads=$db->fetch_array($query);$threadcount=$forum_threads['threads'];if($ismod==true){$threadcount+=$forum_threads['unapprovedthreads']+$forum_threads['deletedthreads'];}// If we have 0 threads double check there aren't any "moved" threads
if($threadcount==0){$query=$db->simple_select("threads","COUNT(tid) AS threads","fid = '$fid' $useronly$visibleonly",array('limit'=>1));$threadcount=$db->fetch_field($query,"threads");}}}
if($fpermissions['canviewthreads']!=0){// How many posts are there?
if($datecutsql||$useronly||$prefixsql){$query=$db->simple_select('threads','COUNT(tid) AS threads',"fid='{$fid}'{$useronly}{$visibleonly}{$datecutsql}{$prefixsql}",array('limit'=>1));$threadcount=$db->fetch_field($query,"threads");}else{$query=$db->simple_select("forums","threads, unapprovedthreads, deletedthreads","fid = '{$fid}'",array('limit'=>1));$forum_threads=$db->fetch_array($query);$threadcount=$forum_threads['threads'];if($ismod==true){$threadcount+=$forum_threads['unapprovedthreads']+$forum_threads['deletedthreads'];}// If we have 0 threads double check there aren't any "moved" threads
if($threadcount==0){$query=$db->simple_select('threads','COUNT(tid) AS threads',"fid='{$fid}'{$visibleonly}",array('limit'=>1));$threadcount=$db->fetch_field($query,"threads");}}}