I seriously have no idea how to fix this..
Quotes are missing around "pages.index", PHP then thinks pages is a constant as that's how you're supposed to reference a constant
pages