Feature: Automatic Optimisation of Half-Empty Catalogs

This automatically detects if a catalog contains more than 20% (to be discussed) of free space and invokes a `VACUUM` to optimize it. The patch uses SQLite's `PRAGMA page_count` and `PRAGMA freelist_count` to determine how much free space is contained in an SQLite database file. This indicator has the advantage that it is transparent to the actual database scheme and more reliable than looking at the `MAX(rowid)` to `COUNT(*)` ratio in the `catalog` table.
Additionally it contains a test case that provokes the described behaviour.