fix for #483

Fixes issues with pagesArray being manipulated detrimentally
cleanup
fixes menu sorting in cke link
dup line