Add pagination to course session catalogue - refs #7273

Your function call would be better *out* of the condition (call the function first, then enter the condition)