Reorganized gen_page_streaks()

Two function were split out of the function; the first
is sql_load_streaks() that does the loading from backend
database; the other is process_streaks() that builds
data structure for the Template Toolkit template.