List all websites and count of visited pages in last month

Hi,
I would like to write simple php script and it should write down list of all websites stored in system with count of visited pages in last month.
Can somebody provide simple code for this?

for example it should look like:
www.aaa.aa pages:15900
www.bbb.bb pages:42143
www.ccc.cc pages:17 890 590

thank you