Fixed issue with too many pages in the legend when using legend navigation. Closes #2617.