This is a really expensive/slow method for checking whether the id is in the pages array. I recommend using something like hasOwnProperty, which is WAYYYY faster.