To better clarify the difference between get / set ....
The setter is called when some explicitly sets the value via .attr. In your example, no one is setting pages directly so "set" is not appropriate.
Get is called when someone tries to read the value. People will be calling .attr("pages") ... so use get.