Remove full table scans from counter.php

This way the queries are fast on big databases. Now it uses the indexed pk to count the users.