added some clumsy getNextSubtopic code for pagination