Inelastic effects in X-ray photoelectron spectroscopy