Flask fixing-up

Still not functional but basic logic for pagination inserted.