Theory of pH changes in water desalination by capacitive deionization