pH measurements in theory and practice