How to list most viewed nodes using Statistics module? How to list most viewed nodes using Statistics module in Drupal 6?

I'm looking for the PHP code to use in a custom theme.
I should have enabled this feature in admin panel before using the following code:

$number_of_hot = '10';
$hot_result = db_query_range("SELECT nid FROM {node_counter} ORDER BY totalcount DESC", array(), 0, $number_of_hot);
while ($hotid = db_result($hot_result)) {
$hot = node_load($hotid);
print $hot-&gt;title;
}