Added option to use different database for history

This adds an option to use a different database for the history table.

If a historydb or historytable option is set in the config.xml, it will use that database/table for logging history, otherwise it will fall back to the same history table in the same database as the rest of Loris and existing projects will be unaffected.