Started implementing the statistics page

This code requires modifications to the database, which are not
committed here.