Shouldn't hold this pull request up at all, but if other changes are required, it might make sense to remove this "if" and the "endif" right after the start of the footer tag (so that there is one "if previous or next" that encompasses everything.

Less tags (particularly django template tags) -> more readable