Fix variable scope for dashboard currentpage and countdata.