Factors mediating the impacts of child abuse and intimate partner violence on chronic pain: a cross-sectional study