In the new KoboTouch driver, this is what I am using to get the page number from the Count Pages plugin.
This is the code I am using in the pages field.
Code:
program:floor($$#pages)
It works. You just have to connect once more after your eBooks is imported into the Kobo database. And you have to have Metadata Management set to Automatic management turned on.