Russia's Maria Sharapova is through to the quarter finals of the Pan Pacific Open, although she didn't have it all her own way against Lucie Safarova.