Added some debugging code:
// total of items
if($this->total_items if($this->table_key)
{
$sql = "str_replace($bd_fields,'count('.$this->table_key.')',$this->get_sql_select()).$this->get_sql_where(false)";
echo "IF QUERY: " . $sql;
$result=mysql_query($sql) or die(mysql_error());
}
else
{
$sql = "str_replace($bd_fields,'count('.$this->sql_fields[0].')',$this->get_sql_select()).$this->get_sql_where(false)";
echo "ELSE QUERY: " . $sql;
$result=mysql_query($sql) or die(mysql_error());
$this->total_items=mysql_fetch_row($result);
$this->total_items=$this->total_items[0];
}
mysql_free_result($result);
}