diff --git a/portal-web/docroot/html/portlet/wiki/view_page_activities.jsp b/portal-web/docroot/html/portlet/wiki/view_page_activities.jsp
index 184075b7b29cf1bd1d1741062380c4ce979994aa..d41e38bc449edf64230fe9ecac41976924f1b0df 100644
--- a/portal-web/docroot/html/portlet/wiki/view_page_activities.jsp
+++ b/portal-web/docroot/html/portlet/wiki/view_page_activities.jsp
@@ -67,7 +67,11 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 		>
 
 			<%
-			User socialActivityUser = UserLocalServiceUtil.getUserById(socialActivity.getUserId());
+			User socialActivityUser = UserLocalServiceUtil.fetchUserById(socialActivity.getUserId());
+
+			if (socialActivityUser == null) {
+				socialActivityUser = UserLocalServiceUtil.getDefaultUser(socialActivity.getCompanyId());
+			}
 
 			JSONObject extraDataJSONObject = JSONFactoryUtil.createJSONObject(socialActivity.getExtraData());
 
@@ -98,7 +102,14 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 						<liferay-util:buffer var="attachmentTitle">
 							<c:choose>
 								<c:when test="<%= fileVersion != null %>">
-									<aui:a href="<%= PortletFileRepositoryUtil.getPortletFileEntryURL(themeDisplay, fileEntry, StringPool.BLANK) %>"><%= title %></aui:a>
+
+									<%
+									String portletFileEntryURL = PortletFileRepositoryUtil.getPortletFileEntryURL(themeDisplay, fileEntry, StringPool.BLANK);
+
+									String downloadPortletFileEntryURL = HttpUtil.addParameter(portletFileEntryURL, "download", true);
+									%>
+
+									<aui:a href="<%= downloadPortletFileEntryURL %>"><%= title %></aui:a>
 								</c:when>
 								<c:otherwise>
 									<%= title %>
@@ -111,21 +122,21 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 								<liferay-ui:icon
 									image="clip"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "x-added-the-attachment-x", new Object[] {socialActivityUser.getFullName(), attachmentTitle}) %>'
+									message='<%= LanguageUtil.format(pageContext, "x-added-the-attachment-x", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), attachmentTitle}) %>'
 								/>
 							</c:when>
 							<c:when test="<%= socialActivity.getType() == SocialActivityConstants.TYPE_MOVE_ATTACHMENT_TO_TRASH %>">
 								<liferay-ui:icon
 									image="delete_attachment"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "x-removed-the-attachment-x", new Object[] {socialActivityUser.getFullName(), attachmentTitle}) %>'
+									message='<%= LanguageUtil.format(pageContext, "x-removed-the-attachment-x", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), attachmentTitle}) %>'
 								/>
 							</c:when>
 							<c:when test="<%= socialActivity.getType() == SocialActivityConstants.TYPE_RESTORE_ATTACHMENT_FROM_TRASH %>">
 								<liferay-ui:icon
 									image="undo"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "x-restored-the-attachment-x", new Object[] {socialActivityUser.getFullName(), attachmentTitle}) %>'
+									message='<%= LanguageUtil.format(pageContext, "x-restored-the-attachment-x", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), attachmentTitle}) %>'
 								/>
 							</c:when>
 						</c:choose>
@@ -145,7 +156,7 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 
 						<liferay-ui:icon
 							label="<%= true %>"
-							message='<%= LanguageUtil.format(pageContext, "x-added-a-comment", new Object[] {socialActivityUser.getFullName(), viewPageURL + "#wikiCommentsPanel"}) %>'
+							message='<%= LanguageUtil.format(pageContext, "x-added-a-comment", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), viewPageURL + "#wikiCommentsPanel"}) %>'
 						/>
 					</c:when>
 
@@ -154,13 +165,13 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 						<%
 						double version = extraDataJSONObject.getDouble("version");
 
-						WikiPage socialActivityWikiPage = WikiPageLocalServiceUtil.getPage(node.getNodeId(), wikiPage.getTitle(), version);
+						WikiPage socialActivityWikiPage = WikiPageLocalServiceUtil.fetchPage(node.getNodeId(), wikiPage.getTitle(), version);
 						%>
 
 						<portlet:renderURL var="viewPageURL">
 							<portlet:param name="struts_action" value="/wiki/view" />
 							<portlet:param name="nodeName" value="<%= node.getName() %>" />
-							<portlet:param name="title" value="<%= socialActivityWikiPage.getTitle() %>" />
+							<portlet:param name="title" value="<%= wikiPage.getTitle() %>" />
 							<portlet:param name="version" value="<%= String.valueOf(version) %>" />
 						</portlet:renderURL>
 
@@ -169,54 +180,75 @@ iteratorURL.setParameter("title", wikiPage.getTitle());
 								<liferay-ui:icon
 									image="trash"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "activity-wiki-page-move-to-trash", new Object[] {StringPool.BLANK, socialActivityUser.getFullName(), socialActivityWikiPage.getTitle()}) %>'
+									message='<%= LanguageUtil.format(pageContext, "activity-wiki-page-move-to-trash", new Object[] {StringPool.BLANK, HtmlUtil.escape(socialActivityUser.getFullName()), wikiPage.getTitle()}) %>'
 								/>
 							</c:when>
 							<c:when test="<%= socialActivity.getType() == SocialActivityConstants.TYPE_RESTORE_FROM_TRASH %>">
 								<liferay-util:buffer var="pageTitleLink">
-									<aui:a href="<%= viewPageURL.toString() %>"><%= socialActivityWikiPage.getTitle() %></aui:a>
+									<c:choose>
+										<c:when test="<%= socialActivityWikiPage != null %>">
+											<aui:a href="<%= viewPageURL.toString() %>"><%= wikiPage.getTitle() %></aui:a>
+										</c:when>
+										<c:otherwise>
+											<%= wikiPage.getTitle() %>
+										</c:otherwise>
+									</c:choose>
 								</liferay-util:buffer>
 
 								<liferay-ui:icon
 									image="undo"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "activity-wiki-page-restore-from-trash", new Object[] {StringPool.BLANK, socialActivityUser.getFullName(), pageTitleLink}) %>'
+									message='<%= LanguageUtil.format(pageContext, "activity-wiki-page-restore-from-trash", new Object[] {StringPool.BLANK, HtmlUtil.escape(socialActivityUser.getFullName()), pageTitleLink}) %>'
 								/>
 							</c:when>
 							<c:when test="<%= socialActivity.getType() == WikiActivityKeys.ADD_PAGE %>">
 								<liferay-util:buffer var="pageTitleLink">
-									<aui:a href="<%= viewPageURL.toString() %>"><%= socialActivityWikiPage.getTitle() %></aui:a>
+									<c:choose>
+										<c:when test="<%= socialActivityWikiPage != null %>">
+											<aui:a href="<%= viewPageURL.toString() %>"><%= wikiPage.getTitle() %></aui:a>
+										</c:when>
+										<c:otherwise>
+											<%= wikiPage.getTitle() %>
+										</c:otherwise>
+									</c:choose>
 								</liferay-util:buffer>
 
 								<liferay-ui:icon
 									image="add_article"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "x-added-the-page-x", new Object[] {socialActivityUser.getFullName(), pageTitleLink}) %>'
+									message='<%= LanguageUtil.format(pageContext, "x-added-the-page-x", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), pageTitleLink}) %>'
 								/>
 							</c:when>
 							<c:when test="<%= socialActivity.getType() == WikiActivityKeys.UPDATE_PAGE %>">
 								<liferay-util:buffer var="pageTitleLink">
-									<aui:a href="<%= viewPageURL.toString() %>">
-										<%= version %>
-
-										<c:if test="<%= socialActivityWikiPage.isMinorEdit() %>">
-											(<liferay-ui:message key="minor-edit" />)
-										</c:if>
-									</aui:a>
+									<c:choose>
+										<c:when test="<%= socialActivityWikiPage != null %>">
+											<aui:a href="<%= viewPageURL.toString() %>">
+												<%= version %>
+
+												<c:if test="<%= socialActivityWikiPage.isMinorEdit() %>">
+													(<liferay-ui:message key="minor-edit" />)
+												</c:if>
+											</aui:a>
+										</c:when>
+										<c:otherwise>
+											<%= version %>
+										</c:otherwise>
+									</c:choose>
 								</liferay-util:buffer>
 
 								<liferay-ui:icon
 									image="edit"
 									label="<%= true %>"
-									message='<%= LanguageUtil.format(pageContext, "x-updated-the-page-to-version-x", new Object[] {socialActivityUser.getFullName(), pageTitleLink}) %>'
+									message='<%= LanguageUtil.format(pageContext, "x-updated-the-page-to-version-x", new Object[] {HtmlUtil.escape(socialActivityUser.getFullName()), pageTitleLink}) %>'
 								/>
 
-								<c:if test="<%= socialActivityWikiPage.getStatus() != WorkflowConstants.STATUS_APPROVED %>">
+								<c:if test="<%= (socialActivityWikiPage != null) && socialActivityWikiPage.getStatus() != WorkflowConstants.STATUS_APPROVED %>">
 									<span class="activity-status"><liferay-ui:message key="<%= WorkflowConstants.getStatusLabel(socialActivityWikiPage.getStatus()) %>" /></span>
 								</c:if>
 
-								<c:if test="<%= Validator.isNotNull(socialActivityWikiPage.getSummary()) %>">
-									<em class="activity-summary"><%= StringPool.QUOTE + socialActivityWikiPage.getSummary() + StringPool.QUOTE %></em>
+								<c:if test="<%= (socialActivityWikiPage != null) && Validator.isNotNull(socialActivityWikiPage.getSummary()) %>">
+									<em class="activity-summary"><%= StringPool.QUOTE + HtmlUtil.escape(socialActivityWikiPage.getSummary()) + StringPool.QUOTE %></em>
 								</c:if>
 							</c:when>
 						</c:choose>
