You might be overcomplicating yourself. Grouping by page will give you one row per page value. Using COUNT(DISTINCT column) will count for each unique value.
You'll end up with a code as simple as this:
SELECT page,
COUNT(DISTINCT username) usercount
FROM visited
GROUP BY page