restructuring DB access, step 1/2

using prefetch to improve performance
still many selects for the preference values
restructuring DB access, step 2/2

the whole preferences page now only needs 4 sql queries
dynamic page title