This function purges old versions of all pages stored in the database and just keeps the newest versions.