Add pages virtual attribute to documents