Pedrosa battles through pain in qualifying