First of all, you need of course to import wixLocation from ‘wix-location’;
Second, I’m not sure what kind of page is it. On one hand you counted the numberOfItems which means there’re many items in the dataset. On the other hand, you used .getCurrentItem() that can get a single item. So you should elaborate a little bit more and explain what you’re trying to achieve.